package com.propose.validator;

import org.springframework.validation.Errors;
import org.springframework.validation.ValidationUtils;
import org.springframework.validation.Validator;

import com.propose.domain.ProposeCommand;

public class ProposeValidator implements Validator{

	@Override
	public boolean supports(Class<?> clazz) {
		return ProposeCommand.class.isAssignableFrom(clazz);
	}

	@Override
	public void validate(Object target, Errors errors) {
		/*ValidationUtils.rejectIfEmptyOrWhitespace(errors, "upload", "required");*/
		ValidationUtils.rejectIfEmptyOrWhitespace(errors, "region", "required");
		ValidationUtils.rejectIfEmptyOrWhitespace(errors, "religion", "required");
		ValidationUtils.rejectIfEmptyOrWhitespace(errors, "acaability", "required");
		ValidationUtils.rejectIfEmptyOrWhitespace(errors, "jobcluster", "required");
		ValidationUtils.rejectIfEmptyOrWhitespace(errors, "job", "required");
		ValidationUtils.rejectIfEmptyOrWhitespace(errors, "salary", "required");
		ValidationUtils.rejectIfEmptyOrWhitespace(errors, "height", "required");
		ValidationUtils.rejectIfEmptyOrWhitespace(errors, "exmarry", "required");
		ValidationUtils.rejectIfEmptyOrWhitespace(errors, "content", "required");
		ValidationUtils.rejectIfEmptyOrWhitespace(errors, "password", "required");
	}
}